<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8" />
	<title>beginBitmapFill</title>
	<script type="text/javascript" src="../lufylegend-1.7.7.js"></script>
	<script type="text/javascript" src="../lufylegend.ui-0.1.1.js"></script>
</head>
<body>
<div id="legend"></div>
<script>
init(50,"legend",800,600,main);
var messageText;
function main(){
	backLayer = new LSprite();
	addChild(backLayer);

	var txt;
	txt = new LTextField();
	txt.color="red";
	txt.text = "ajax通信需要服务器支持，测试本demo请先确认。";
	backLayer.addChild(txt);

	txt = new LTextField();
	txt.y = 30;
	txt.text = "点击按钮会通过ajax从后台取得信息。";
	backLayer.addChild(txt);


	var button01 = new LButtonSample1("ajax测试按钮");
	button01.x = 10;
	button01.y = 80;
	backLayer.addChild(button01);
	button01.addEventListener(LMouseEvent.MOUSE_UP,getMessage);


	messageText = new LTextField();
	messageText.y = 150;
	messageText.text = "等待中";
	backLayer.addChild(messageText);
}
function getMessage(event){
	//第一个参数是ajax通信的访问路径，如果需要向后台传递参数，则需设定第二个参数（json形式）
	LAjax.post("./data.txt",{},function(data){
		messageText.text = "得到数据：【"+data+"】";
	});
}
</script>
</body>
</html>